package com.woniuxy.joylifeshop.queue;

import com.woniuxy.joylifeshop.service.serviceImpl.CartServiceImpl;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class CartCustomer {



    @Autowired
    CartServiceImpl cartService;

    /**
    * @Author SooYoo
    * @Description 防止数据库访问过度
    * @Param
    * @Return
    **/
    @RabbitListener(queues="limit_queue")
    @RabbitHandler
    public void createCartItem(String inf){

        String[] split = inf.split(",");
        String shopId = split[0];
        String userId = split[1];



        String cartItem = cartService.createCartItem(shopId, userId);

        System.out.println(cartItem);

    }




}
